/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.provider;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.util.Adaptedaui2android7cuiAdapterFactory;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class Adaptedaui2android7cuiItemProviderAdapterFactory extends Adaptedaui2android7cuiAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection<Object> supportedTypes = new ArrayList<Object>();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Adaptedaui2android7cuiItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.Action} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActionItemProvider actionItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.Action}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createActionAdapter() {
		if (actionItemProvider == null) {
			actionItemProvider = new ActionItemProvider(this);
		}

		return actionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.PresentationUnit} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PresentationUnitItemProvider presentationUnitItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.PresentationUnit}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createPresentationUnitAdapter() {
		if (presentationUnitItemProvider == null) {
			presentationUnitItemProvider = new PresentationUnitItemProvider(this);
		}

		return presentationUnitItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.AbstractUIComponent} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AbstractUIComponentItemProvider abstractUIComponentItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.AbstractUIComponent}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAbstractUIComponentAdapter() {
		if (abstractUIComponentItemProvider == null) {
			abstractUIComponentItemProvider = new AbstractUIComponentItemProvider(this);
		}

		return abstractUIComponentItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.InputField} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InputFieldItemProvider inputFieldItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.InputField}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInputFieldAdapter() {
		if (inputFieldItemProvider == null) {
			inputFieldItemProvider = new InputFieldItemProvider(this);
		}

		return inputFieldItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.OutputField} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OutputFieldItemProvider outputFieldItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.OutputField}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createOutputFieldAdapter() {
		if (outputFieldItemProvider == null) {
			outputFieldItemProvider = new OutputFieldItemProvider(this);
		}

		return outputFieldItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.MultipleChoice} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MultipleChoiceItemProvider multipleChoiceItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.MultipleChoice}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createMultipleChoiceAdapter() {
		if (multipleChoiceItemProvider == null) {
			multipleChoiceItemProvider = new MultipleChoiceItemProvider(this);
		}

		return multipleChoiceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.SingleChoice} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SingleChoiceItemProvider singleChoiceItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.SingleChoice}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSingleChoiceAdapter() {
		if (singleChoiceItemProvider == null) {
			singleChoiceItemProvider = new SingleChoiceItemProvider(this);
		}

		return singleChoiceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.Navigator} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NavigatorItemProvider navigatorItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.Navigator}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createNavigatorAdapter() {
		if (navigatorItemProvider == null) {
			navigatorItemProvider = new NavigatorItemProvider(this);
		}

		return navigatorItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.Activator} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActivatorItemProvider activatorItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.Activator}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createActivatorAdapter() {
		if (activatorItemProvider == null) {
			activatorItemProvider = new ActivatorItemProvider(this);
		}

		return activatorItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.PresentationSystem} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PresentationSystemItemProvider presentationSystemItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.PresentationSystem}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createPresentationSystemAdapter() {
		if (presentationSystemItemProvider == null) {
			presentationSystemItemProvider = new PresentationSystemItemProvider(this);
		}

		return presentationSystemItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.UIContainerRelationship} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected UIContainerRelationshipItemProvider uiContainerRelationshipItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.UIContainerRelationship}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createUIContainerRelationshipAdapter() {
		if (uiContainerRelationshipItemProvider == null) {
			uiContainerRelationshipItemProvider = new UIContainerRelationshipItemProvider(this);
		}

		return uiContainerRelationshipItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.UITemporalRelationship} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected UITemporalRelationshipItemProvider uiTemporalRelationshipItemProvider;

	/**
	 * This creates an adapter for a {@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui2android7cui.UITemporalRelationship}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createUITemporalRelationshipAdapter() {
		if (uiTemporalRelationshipItemProvider == null) {
			uiTemporalRelationshipItemProvider = new UITemporalRelationshipItemProvider(this);
		}

		return uiTemporalRelationshipItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (actionItemProvider != null) actionItemProvider.dispose();
		if (presentationUnitItemProvider != null) presentationUnitItemProvider.dispose();
		if (abstractUIComponentItemProvider != null) abstractUIComponentItemProvider.dispose();
		if (inputFieldItemProvider != null) inputFieldItemProvider.dispose();
		if (outputFieldItemProvider != null) outputFieldItemProvider.dispose();
		if (multipleChoiceItemProvider != null) multipleChoiceItemProvider.dispose();
		if (singleChoiceItemProvider != null) singleChoiceItemProvider.dispose();
		if (navigatorItemProvider != null) navigatorItemProvider.dispose();
		if (activatorItemProvider != null) activatorItemProvider.dispose();
		if (presentationSystemItemProvider != null) presentationSystemItemProvider.dispose();
		if (uiContainerRelationshipItemProvider != null) uiContainerRelationshipItemProvider.dispose();
		if (uiTemporalRelationshipItemProvider != null) uiTemporalRelationshipItemProvider.dispose();
	}

}
